package com.aigis.big4.tmp.javase;

import java.util.StringTokenizer;

/**
 *https://blog.csdn.net/xiaoaiqi/article/details/78610615
 */
public class StringTokenizerTest {

    public static void main(String[] args){
        String s = new String("The=Java=platform=is=the=ideal=platform=for=network=computing");
        String s2 = new String("www.baidu.com");
        //分词器构造函数三个参数，第一个是待分隔的字符串，第二个为分隔字符串，以字符为分隔单位（比如the，可能匹配到e，就会分隔），
        //第三个参数说明是否要把分割字符串作为标记返回
        StringTokenizer st = new StringTokenizer(s, "the");
        StringTokenizer st2=new StringTokenizer(s2,".");
//        System.out.println("Token Total:" + st.countTokens());
//        while (st.hasMoreElements()) {
//            System.out.println(st.nextToken());
//        }
        System.out.println("Token Total:" + st2.countTokens());
        while (st2.hasMoreElements()) {
            System.out.println(st2.nextToken());
        }
    }

}
